<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>事件处理</title>
  <script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
  <style>
    .box {
      border-bottom: 1px solid red;
      margin-bottom: 20px;
      padding-bottom: 5px;
    }
    .tip {
      color: red;
    }
  </style>
</head>
<body>
  <h1>事件处理</h1>
  <div id="app">

    <div class="box">
      <h3>stop事件修饰符,stop阻止单击事件继续传播,是阻止其传播，而不是阻止当前点击事件的执行</h3>
      <p @click="level1">
        <button @click.stop="level2">添加了stop修饰符</button>
      </p>

      <p @click="level1">
        <button @click="level2">没添加stop修饰符</button>
      </p>

    </div>
    
    <div class="box">
      <h3>按键修饰符</h3>
      <p>
        <input type="text"  placeholder="输入账号名" @keyup.enter="go">
        <span>在这个输入框，敲回车，那么就执行go函数</span>
      </p>
    </div>

    

  </div>

  <script>
    var vue = new Vue({
      el: "#app",
      data: {
        msg: "Hello, World"
      },
      methods: {
        go: function () {
          alert('收到')  
        },
        level2: function () {
          alert('child')
        },
        level1: function () {
          alert('parent')
        }
      }
    })
  </script>
</body>
</html>